# 最终答案是 85959030
# import re
#
# res = 98765432 - 12345677
# pattern = re.compile(r'2*0*2*3')
# for numb in range(12345678, 98765432 + 1):
#     search = pattern.search(str(numb))
#     if search:
#         print("Find : ", search.groups(), "in", numb)
#         res -= 1
# print(res)


import re

pat = re.compile(r'\d*'.join('2023'))
nums = range(12345678, 98765432 + 1)
print(sum(not re.search(pat, i) for i in map(str, nums)))